/*
 * Copyright © 2018 CODESTD.COM Inc. All rights reserved.
 */
package com.codestd.security.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

/**
 * 主控制器
 *
 * @author jaune
 * @since 1.0.0
 */
@Controller
public class MainController {

    private static Logger logger = LoggerFactory.getLogger(MainController.class);

    @Autowired

    @GetMapping("/")
    public ModelAndView home() {
        return new ModelAndView("index");
    }

    @ResponseBody
    @GetMapping("/anonymous")
    public String main() {
        return "任何人都可以访问我";
    }

    @ResponseBody
    @GetMapping("/authc")
    public String authc() {
        return "需要登录才能访问";
    }

    @ResponseBody
    @GetMapping("/role")
    public String role() {
        return "需要有Admin角色才能访问";
    }

    @ResponseBody
    @GetMapping("/permissive")
    public String permissive() {
        return "permissive mode";
    }
}
